def count(nums):
    res = 0
    for i in range(len(nums)):
        if nums[i] == 1:
            res += 1
    return res
def func(nums):
    if len(nums) == 0 or count(nums) == 0:
        return 0
    for i in range(len(nums)):
        rescount = count(nums[i+1:])
        if rescount <= i+1:
            return i+1
# nums = [0,0,0]
# print(func(nums))



